<template>
  <div>
    <div class="header">
      <el-input
        v-model="input"
        @change="search"
        placeholder="请输入内容"
      ></el-input>
      <el-button type="primary">查询按钮</el-button>
      <el-button type="primary">添加按钮</el-button>
    </div>

    <div class="content">
      <el-table :data="tableData" :border="true" style="width: 100%">
        <el-table-column prop="category" label="日期" width="180">
        </el-table-column>
        <el-table-column prop="id" label="编号" width="80px"> </el-table-column>
        <el-table-column prop="num" label="姓名" width="80px">
        </el-table-column>
        <el-table-column prop="price" label="姓名" width="80px">
        </el-table-column>
        <el-table-column prop="title" label="title" width="80px">
        </el-table-column>
        <el-table-column prop="" label="descs"> </el-table-column>
      </el-table>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      input: "",
      tableData: [],
    };
  },
  methods: {
    search(val) {
      console.log(val);
      this.$api.getsearch({ search: val }).then((res) => {
        if (status == 200) {
          this.tableData = res.data.result;
        } else {
          this.tableData = [];
        }
      });
    },
    http(params) {
      this.$api.getgooList({ params}).then((res) => {
        console.log(res.data);
        this.tableData = res.data.data;
      });
    },
  },
  created() {
    this.http(1);
  },
};
</script>

<style lang="less" scoped>
.header {
  display: flex;
  margin: 20px;
  .el-button {
    // margin-left: 8px ;
    margin: 0% 10px 0 10px;
  }
}
.content {
  margin: 20px;
}
</style>